
Notes
-----
Describes objects used for ".PRT/.BMP" (unit and button) graphics and "Well????.BMP" (TileSet) graphics.

The Graphics object is used for the .PRT meta data, and the BmpManager class is used to handle the actual bitmap data (for both the .BMP file associated with the .PRT file, and the Well????.BMP TileSet graphics)




Graphics
--------
Base offset of global graphics object: 0x004EFD68


Offset 		Size 	Description
------ 		---- 	-----------
0x0		4	char *palData?
0x4		4	int pal???Size?
0x8		20*X	struct ImageInfo imageInfo[] (max of 5608 structs)
 0x8		 4	 int ScanlineByteWidth
 0xC		 4	 int DataOffset
 0x10		 4	 int Height
 0x14		 4	 int Width
 0x18		 2	 short TypeFlags	[4 = IsShadow]
 0x1A		 2	 short PaletteIndex
0x1B628		4	int numImages
0x1B62C		112*X	struct AnimationInfo animationInfo[0..2175] (max of 2176 structs)
 0x1B62C	 4	 
 0x1B630	 4	 int selectionBox.left
 0x1B634	 4	 int selectionBox.top
 0x1B638	 4	 int selectionBox.right
 0x1B63C	 4	 int selectionBox.bottom
 0x1B640	 4	 int pixelXDisplacement
 0x1B644	 4	 int pixelYDisplacement
 0x1B648	 4	 
 0x1B64C	 4	 int numFrames
 0x1B650	 4	 FrameInfo[]* frameInfo (pointer to starting record in master list)
 0x1B654	 2	 short frameOptionalInfoStartIndex  [numFrames of (partially) valid optional info]
 0x1B656
 0x1B658	 4	 num???
 0x1B65C	 16*X	Rect[0..3] rect???
  0x1B65C		4		p1.x
  0x1B660		4		p1.y
  0x1B664		4		p2.x
  0x1B668		4		p2.y
----
0x56E2C		4	int numAnimations
0x56E30		4	BmpManager*
0x56E34		4	FrameInfo[]* frameInfo (master list, holds data for all animations)
0x56E38		4	FrameComponentInfo[]* frameComponentInfo
0x56E3C		4	FrameOptionalInfo[]* frameComponentInfo




Bitmap
------
Min Size: 0x20
Max Size: 0x20
------
Offset 	Size 	Description
------ 	---- 	-----------
0x0	4	int width
0x4	4	int height  		[abs(BITMAPINFOHEADER.biHeight)]  [or tileHeight after TileSet graphics are completely loaded]
0x8	4	int pitch
0xC	4	int bitDepth		[16 for TileSets, 8 for PRT]
0x10	4	int imageBufferSize 	[((scanlineByteWidth * bitDepth) / 8) * height]  [Size of allocated memory]
0x14	4	char* imageBuffer  	[&bmpFileData[sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + clrUsed*sizeof(RGBQUAD)]
0x18	4	Palette* palette
0x1C	4	flags 	 		[Value of 8 means don't free iamgeBuffer* memory]


Bitmap:BmpManager
-----------------
Base Class Size: 0x20
Max Size: 0xDC	[See 0x418B78]
-----------------
0x20	4	numLightLevels+1
0x24	4	0
0x28	4	enum DrawMethod	drawMethod	[bpp = 1, 8, 16 => 3, 0, 4]
0x2C	4	short[256][]* lightLevelPal16  	[16 bpp, 555 (MSB) RGB (LSB)]
0x30	0x20	char[32] ??? (light level related)
0x50		0
0x54	4*32	(???1*)[32] ??? (light level related)
0xD4		0
0xD8		0


BmpManager:Prt
--------------

Offset 	Size 	Description
------ 	---- 	-----------
0xDC	4	HANDLE hFile
0xE0	4	HANDLE hMapping
0xE4	4	char *bmpFileData
0xE8	4	int fileSize
0xEC	4	char* pixelData [duplicate of value at offset 0x14]
0xF0	4	0
0xF4	4	0
0xF8	4	0
---------------------------


BmpManager:TileSet
------------------
Size: 0xFC	[See 0x435FE8]

Offset 	Size 	Description
------ 	---- 	-----------
0xDC	4	numTiles?
0xE0	4	numTiles?
0xE4	4	
0xE8	4	
0xEC	4	tilePixelHeight	[Height of individual tile in pixels]
0xF0	4	pixelHeight	[Height of all tiles combined]
0xF4	4	bytesPerTile	[scanLineByteWidth*tilePixelHeight]
0xF8	4	pixelData*





<Following was moved from the .PRT file format specs>

Structures Used By Outpost 2
----------------------------

These structures were used by Outpost 2 during the load process. They don't really relate to the file format, but rather how Outpost 2 stores the data in memory after it's been loaded.


FrameInfo
Size: 14 bytes
Offset 	Size 	Description
------ 	---- 	-----------
0x0	2	rect.left  [0x7FFE = Auto compute bounding rect (hardcoded initialization), 0x7FFF = Never compute bounding rect]
0x2	2	rect.top
0x4	2	rect.right
0x6	2	rect.bottom
0x8	2	numFrameComponents  [number of sub images making up this frame of animation (first byte read AND 0x7F)]
0xA	4	FrameComponentInfo *frameComponentInfo (set to current when loading)
---------------------------


FrameComponentInfo
Size: 6 bytes
Offset 	Size 	Description
------ 	---- 	-----------
0x0	2	pixelXOffset (Left)
0x2	2	pixelYOffset (top)
0x4	2	imageInfoIndex (Image to display in the frame at the given offsets)


FrameOptionalInfo
Size: 4 bytes
Offset 	Size 	Description
------ 	---- 	-----------
0x0	1	offsetX
0x1	1	offsetY
---------------------------
0x2	1	
0x3	1	


Note: If FrameOptionalInfo is given (in whole or in part) for any frame in an animation, then space if reserved for all frames in the animation. If optional data is supplied for some but not all frames in an animation, than the optional data is left uninitialized for those frames that have optional data missing. 

Note: The first two optional bytes are read in if the upper bit of rect.left is set when reading the FrameData. One byte is read from the file and stored as 2 bytes in memory for rect.left.
Note: The second two optional bytes are read in if the upper bit of rect.top is set when reading the FrameData. One byte is read from the file and stored as 2 bytes in memory for rect.top.
